package artid.com.arttogo.view.horizonlistview;


import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import artid.com.arttogo.bean.AppItem;

/**
 * 项目名称：ArtworkArt
 * 类名称：NewartistArtistListParser
 * 类描述：艺术家信息和作品信息实体类和解析
 * 创建人：耿卫斌
 * 创建时间：2017-1-4 上午11:20:02
 */
public class NewartistArtistListParser extends AppItem implements Serializable {
    private static final long serialVersionUID = 1L;
    private List<NewartistArtistList_Bannerinfo> bannerinfo;
    private List<NewartistArtistList_ArtistList> artistList;

    @Override
    public void parse(JSONObject obj) {
        if (null == obj) {
            return;
        }
        JSONArray JsonArray = obj.optJSONArray("bannerinfo");
        if (JsonArray != null) {
            bannerinfo = new ArrayList<NewartistArtistList_Bannerinfo>();
            for (int i = 0; i < JsonArray.length(); i++) {
                try {
                    JSONObject object = JsonArray.getJSONObject(i);
                    NewartistArtistList_Bannerinfo mBannerinfo = new NewartistArtistList_Bannerinfo();
                    mBannerinfo.setCarousel_id(object.optString("carousel_id"));
                    mBannerinfo.setCarousel_imgurl(object.optString("carousel_imgurl"));
                    mBannerinfo.setType(object.optInt("type"));
                    mBannerinfo.setTitle(object.optString("title"));
                    bannerinfo.add(mBannerinfo);
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

        JSONArray jsonArray = obj.optJSONArray("artistList");
        if (jsonArray != null) {
            artistList = new ArrayList<NewartistArtistList_ArtistList>();
            for (int i = 0; i < jsonArray.length(); i++) {
                try {
                    JSONObject object = jsonArray.getJSONObject(i);
                    NewartistArtistList_ArtistList mArtistList = new NewartistArtistList_ArtistList();
                    mArtistList.setArtist_id(object.optString("artist_id"));
                    mArtistList.setRealname(object.optString("realname"));
                    mArtistList.setArtist_auth(object.optString("artist_auth"));
                    mArtistList.setArtNum(object.optString("artNum"));
                    mArtistList.setAname(object.optString("aname"));
                    mArtistList.setFollowNum(object.optString("followNum"));
                    mArtistList.setArtistimg(object.optString("artistimg"));
                    mArtistList.setIs_follow(object.optInt("is_follow"));
                    JSONArray JsonArray2 = object.optJSONArray("artInfo");
                    List<NewartistArtistList_ArtistList.NewartistArtistList_ArtInfo> artInfo = new ArrayList<NewartistArtistList_ArtistList.NewartistArtistList_ArtInfo>();
                    if (JsonArray2 != null) {
                        for (int j = 0; j < JsonArray2.length(); j++) {
                            try {
                                JSONObject object2 = JsonArray2.getJSONObject(j);
                                NewartistArtistList_ArtistList.NewartistArtistList_ArtInfo mArtInfo = new NewartistArtistList_ArtistList.NewartistArtistList_ArtInfo();
                                mArtInfo.setArt_id(object2.optString("art_id"));
                                mArtInfo.setArtName(object2.optString("artName"));
                                mArtInfo.setArtUrl(object2.optString("artUrl"));
                                artInfo.add(mArtInfo);
                                mArtInfo = null;
                            } catch (JSONException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                        }
                    }
                    mArtistList.setArtInfo(artInfo);
                    artistList.add(mArtistList);
                    mArtistList = null;
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public List<NewartistArtistList_Bannerinfo> getBannerinfo() {
        return bannerinfo;
    }

    public void setBannerinfo(List<NewartistArtistList_Bannerinfo> bannerinfo) {
        this.bannerinfo = bannerinfo;
    }

    public List<NewartistArtistList_ArtistList> getArtistList() {
        return artistList;
    }

    public void setArtistList(List<NewartistArtistList_ArtistList> artistList) {
        this.artistList = artistList;
    }

    public NewartistArtistListParser() {
        super();
    }

    public NewartistArtistListParser(
            List<NewartistArtistList_Bannerinfo> bannerinfo,
            List<NewartistArtistList_ArtistList> artistList) {
        super();
        this.bannerinfo = bannerinfo;
        this.artistList = artistList;
    }

    @Override
    public String toString() {
        return "NewartistArtistListParser [bannerinfo=" + bannerinfo
                + ", artistList=" + artistList + "]";
    }

    public class NewartistArtistList_Bannerinfo implements Serializable {
        private static final long serialVersionUID = 1L;
        private String carousel_id;
        private String carousel_imgurl;
        private int type;
        private String title;

        public String getCarousel_id() {
            return carousel_id;
        }

        public void setCarousel_id(String carousel_id) {
            this.carousel_id = carousel_id;
        }

        public String getCarousel_imgurl() {
            return carousel_imgurl;
        }

        public void setCarousel_imgurl(String carousel_imgurl) {
            this.carousel_imgurl = carousel_imgurl;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public NewartistArtistList_Bannerinfo() {
            super();
        }

        public NewartistArtistList_Bannerinfo(String carousel_id,
                                              String carousel_imgurl, int type, String title) {
            super();
            this.carousel_id = carousel_id;
            this.carousel_imgurl = carousel_imgurl;
            this.type = type;
            this.title = title;
        }

        @Override
        public String toString() {
            return "NewartistArtistList_Bannerinfo [carousel_id=" + carousel_id
                    + ", carousel_imgurl=" + carousel_imgurl + ", type=" + type
                    + ", title=" + title + "]";
        }
    }

    public static class NewartistArtistList_ArtistList implements Serializable {
        private static final long serialVersionUID = 1L;
        private String artist_id;
        private String realname;
        private String artist_auth;
        private String artNum;
        private String followNum;
        private String artistimg;
        private int is_follow;
        private String aname;

        private List<NewartistArtistList_ArtInfo> artInfo;

        public String getArtist_id() {
            return artist_id;
        }

        public void setArtist_id(String artist_id) {
            this.artist_id = artist_id;
        }

        public String getAname() {
            return aname;
        }

        public void setAname(String aname) {
            this.aname = aname;
        }

        public String getRealname() {
            return realname;
        }

        public void setRealname(String realname) {
            this.realname = realname;
        }

        public String getArtist_auth() {
            return artist_auth;
        }

        public void setArtist_auth(String artist_auth) {
            this.artist_auth = artist_auth;
        }

        public String getArtNum() {
            return artNum;
        }

        public void setArtNum(String artNum) {
            this.artNum = artNum;
        }

        public String getFollowNum() {
            return followNum;
        }

        public void setFollowNum(String followNum) {
            this.followNum = followNum;
        }

        public String getArtistimg() {
            return artistimg;
        }

        public void setArtistimg(String artistimg) {
            this.artistimg = artistimg;
        }

        public int getIs_follow() {
            return is_follow;
        }

        public void setIs_follow(int is_follow) {
            this.is_follow = is_follow;
        }

        public List<NewartistArtistList_ArtInfo> getArtInfo() {
            return artInfo;
        }

        public void setArtInfo(List<NewartistArtistList_ArtInfo> artInfo) {
            this.artInfo = artInfo;
        }

        public NewartistArtistList_ArtistList() {
            super();
        }

        public NewartistArtistList_ArtistList(String artist_id,
                                              String realname, String artist_auth, String artNum,
                                              String followNum, String artistimg, int is_follow,
                                              List<NewartistArtistList_ArtInfo> artInfo) {
            super();
            this.artist_id = artist_id;
            this.realname = realname;
            this.artist_auth = artist_auth;
            this.artNum = artNum;
            this.followNum = followNum;
            this.artistimg = artistimg;
            this.is_follow = is_follow;
            this.artInfo = artInfo;
        }

        @Override
        public String toString() {
            return "NewartistArtistList_ArtistList [artist_id=" + artist_id
                    + ", realname=" + realname + ", artist_auth=" + artist_auth
                    + ", artNum=" + artNum + ", followNum=" + followNum
                    + ", artistimg=" + artistimg + ", is_follow=" + is_follow
                    + ", artInfo=" + artInfo + "]";
        }

        public static class NewartistArtistList_ArtInfo implements Serializable {
            private static final long serialVersionUID = 1L;
            private String art_id;
            private String artName;
            private String artUrl;

            public String getArt_id() {
                return art_id;
            }

            public void setArt_id(String art_id) {
                this.art_id = art_id;
            }

            public String getArtName() {
                return artName;
            }

            public void setArtName(String artName) {
                this.artName = artName;
            }

            public String getArtUrl() {
                return artUrl;
            }

            public void setArtUrl(String artUrl) {
                this.artUrl = artUrl;
            }

            public NewartistArtistList_ArtInfo() {
                super();
            }

            public NewartistArtistList_ArtInfo(String art_id, String artName,
                                               String artUrl) {
                super();
                this.art_id = art_id;
                this.artName = artName;
                this.artUrl = artUrl;
            }

            @Override
            public String toString() {
                return "NewartistArtistList_ArtInfo [art_id=" + art_id
                        + ", artName=" + artName + ", artUrl=" + artUrl + "]";
            }
        }
    }
}
